<?php

namespace App\Http\Controllers\Backend\Log;

use Illuminate\Http\Request;
use App\Http\Models\Log\LogService;
use App\Http\Controllers\Backend\BackendController;

/*
 * LogController  日志操作类
 *
 * index() 日志列表
 * show() 日志查看
 *
 * @author 金飞虎
 * @email 870741306@qq.com
 * @date 2018/4/5
 * */

class LogController extends BackendController
{
    private $logService;
    private $request;

    public function __construct(LogService $logService, Request $request)
    {
        $this->logService = $logService;
        $this->request = $request;
    }

    /**
     * 日志列表
     * * */
    public function index()
    {
        $logDatas = $this->logService->index($this->request);
        return view('backend.log.index', [
            'logDatas' => $logDatas,
            'request' => $this->request
        ]);
    }

    /**
     * 日志查看
     * * */
    public function show($id)
    {
        $logDatas = $this->logService->show($id);
        return view("backend.log.show", [
            'logDatas' => $logDatas
        ]);
    }

    public function __destruct()
    {
        unset($this->logService);
        unset($this->request);
    }
}
